<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>用户列表</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="__PUBLIC__/X-admin/css/x-admin.css" media="all">
    </head>
    <body>
        <div class="x-nav">
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:29px">ဂ</i> <i class="layui-icon" style="line-height:30px">刷新</i></a>
        </div>
        <div class="x-body">
        	<xblock><button class="layui-btn" onclick="admin_add('添加用户','__MODULE__/Classmanage/add','800','500')"><i class="layui-icon"></i>添加班级</button>
                <form style="float:right;" class="layui-form" action="__MODULE__/Classmanage/index" method="get">
                    <div class="layui-input-inline">
                        <div class="layui-input-inline">
                            <input type="text" name="classname" placeholder="按班级名查找" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-input-inline" style="width:180px">
                        <select name="admin" width="50px" >
                              <option value="">按班主任查找</option>
                            <foreach name="admins" item="rows" >
                                  <option value="{$rows['id']}" >{$rows['name']}</option>
                            </foreach>
                        </select>
                    </div>
                    <button class="layui-btn" type="submit" lay-filter="formDemo"><i class="layui-icon" style="font-size: 20px;" >&#xe615;</i>搜索</button>

                </form>
            </xblock>
			 <table class="layui-table">
                <thead>
                    <tr>
                        <th>班级名</th>
                        <th>班主任</th>
                        <th>讲师</th>
                        <th>项目经理</th>
                        <th>开学时间</th>
                        <th>毕业时间</th>
                        <th>专业</th>
                        <th>状态</th>
                        <th>教室</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    <foreach name="list" item="row" >
                        <tr>
                            <td>{$row['name']}</td>
                            <td>{$row['admin']}</td>
                            <td>{$row['teacher']}</td>
                            <td>{$row['pm']}</td>
                            <td>{$row['start']}</td>
                            <td>
                                <if condition="$row['end'] eq '1970-01-01' "> <else/>{$row['end']}</if>
                            </td>
                            <td>
                                <if condition="$row['major'] eq '0'"> <else/>{$row['major']}</if>
                            </td>
                            <td>
                                <if condition="$row['status'] eq 0">即将开班<elseif condition="$row['status'] eq 1"/>正常上课<else/>已毕业</if>
                            </td>
                            <td>
                                <if condition="$row['class_room'] eq '0' "> <else/>{$row['class_room']}</if>
                            </td>
                            <td class="td-manage">
                                <a title="修改班级信息" href="javascript:;" onclick="admin_edit('修改','__MODULE__/Classmanage/update/id/{$row['id']}','4','','510')" class="ml-5" style="text-decoration:none"> <i style="font-size:30px;color:#5FB878;" class="layui-icon">&#xe642;</i>
                                </a>
                                <a style="text-decoration:none" href="__MODULE__/Classmanage/admin/id/{$row['id']}" title="班级管理信息"> <i style="font-size:30px;color: #1E9FFF;" class="layui-icon">&#xe614;</i>
                                </a>
                            </td>
                        </tr>
                    </foreach>
                </tbody>
            </table>
            <br>
            <div class="total">共{$total}条数据</div>
            <!-- 分页信息 -->
            <div id="pages"></div>
        </div>
        <script src="__PUBLIC__/X-admin/lib/layui/layui.js" charset="utf-8"></script>
        <script src="__PUBLIC__/X-admin/js/x-layui.js" charset="utf-8"></script>
        <script>
            layui.use(['laydate','element','laypage','layer','form'], function(){
              $ = layui.jquery;//jquery
              laydate = layui.laydate;//日期插件
              lement = layui.element();//面包导航
              laypage = layui.laypage;//分页
              layer = layui.layer;//弹出层
              var form = layui.form(); //只有执行了这一步，部分表单元素才会修饰成功

               //调用分页
              laypage({
                cont: 'pages',
                curr: {$curr},
                groups: 5,
                pages: {$page}, //得到总页数
                skip: true,
                jump: function(obj, first){
                  var url = window.location.href;
                  if (url.indexOf('?') < 0) {
                      url = window.location.href;
                  }else{
                      url=url.substr(0, url.indexOf('?'));
                  }
                  search="{$search}";
                  if (!first) {
                    window.location.href=url+search+"/p/"+obj.curr+".html";
                  }
                }
              });  
            });
            //批量删除提交
             function delAll () {
                layer.confirm('确认要删除吗？',function(index){
                    //捉到所有被选中的，发异步进行删除
                    layer.msg('删除成功', {icon: 1});
                });
             };
             /*添加*/
            function admin_add(title,url,w,h){
                x_admin_show(title,url,w,h);
            };
  
            //编辑
            function admin_edit(title,url,id,w,h) {
                x_admin_show(title,url,w,h); 
            };
            // /*删除*/
            // function admin_del(obj,id){
            //     layer.confirm('确认要删除吗？',function(index){
            //         //发异步删除数据
            //         $.post("__MODULE__/Classmanage/delete",{id:id},function(data){
            //           if(data=="失败"){
            //               alert('数据删除失败');

            //           }
            //         });

            //         $(obj).parents("tr").remove();
            //         layer.msg('已删除!',{icon:1,time:1000});
                  
            //     });
            // };
            // 刷新页面
            function reload(){
            	location.replace(location.href);
            }

        </script>
            
    </body>
</html>